import time


def timer(func):
    def deco(*args, **kwargs):
        start_time = time.time()
        func(*args, **kwargs)
        stop_time = time.time()
        print('运行时间是%d秒' % (stop_time-start_time))
    return deco

@timer  #test1=timer(test1)
def test1():
    time.sleep(3)
    print('in the test1')

test1()